<include file="public@header"/>
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a>详情</a></li>
    </ul>
    <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('contact/doedit')}"
          enctype="multipart/form-data">


        <div class="form-group">
            <label for="js-smtpsecure" class="col-sm-2 control-label">
                <span class="form-required">*</span>送审时间
            </label>
            <div class="col-md-6 col-sm-10">
                <input type="date" class="form-control" name="subTime" value="{$res['subTime']}">
            </div>
        </div>


        <div class="form-group">
            <label for="js-smtpsecure" class="col-sm-2 control-label">
                <span class="form-required">*</span>联系单名称
            </label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" name="title" value="{$res['title']}">
            </div>
        </div>

        <div class="form-group">

            <label for="js-smtpsecure" class="col-sm-2 control-label">
                <span class="form-required">*</span>描述
            </label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" name="desc" value="{$res['desc']}">
            </div>
        </div>
        <div class="form-group">

            <label for="js-smtpsecure" class="col-sm-2 control-label">
                <span class="form-required">*</span>金额
            </label>
            <div class="col-md-6 col-sm-10">
                <input type="number" class="form-control" name="price" value="{$res['price']}">
            </div>
        </div>


        <div class="form-group">

            <label for="js-smtpsecure" class="col-sm-2 control-label">
                <span class="form-required">*</span>流程
            </label>
            <div class="col-md-6 col-sm-10">
                <select name="status" class="form-control">
                    <?php
                        if($res['status'] == 1){
                    ?>
                    <option value="1">完成</option>

                    <?php
                        }elseif($res['status'] == 2){
                    ?>
                    <option value="2">未完成</option>

                    <?php
                        }elseif($res['status'] == 3){
                    ?>
                    <option value="3">私了</option>

                    <?php
                        }elseif($res['status'] == 4){
                    ?>
                    <option value="4">作废</option>

                    <?php
                        }
                    ?>


                    <option value="1">完成</option>
                    <option value="2">未完成</option>
                    <option value="3">私了</option>
                    <option value="4">作废</option>
                </select>
            </div>
        </div>


        <!-- <div class="form-group">
            <label for="js-smtpsecure" class="col-sm-2 control-label">
                <span class="form-required">*</span>联系单图片
            </label>
            <div class="col-md-6 col-sm-10">
                <foreach name="res['img']" item="v">
                    <img src="{$v}" alt="" width="250" height="150">
                </foreach>
                <input type="file" name="img[]" multiple/> <br>
            </div>
        </div> -->

        <div class="form-group">
                <label for="js-smtpsecure" class="col-sm-2 control-label">
                    联系单图片
                </label>
                <div class="col-md-6 col-sm-10">
                    <input type="file" name="img[]" class="form-control" id="imgUpload" multiple accept="image/*" />
                    <div id="imgPreviewContainer" class="image-preview-container" style="margin-top: 10px; display: flex; flex-wrap: wrap;"></div>
                </div>
            </div>

        <input type="hidden" name="id" value="{$res['id']}">


        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
                <a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
            </div>
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script src="__STATIC__/js/image-uploader.js"></script>
  <script>
        // 页面加载完成后初始化所有功能
        document.addEventListener('DOMContentLoaded', function() {            
            // 初始化图片上传组件
            // 决算明细图片上传
            const imgUploader = new ImageUploader({
                inputId: 'imgUpload',
                previewContainerId: 'imgPreviewContainer',
                fieldName: 'img',
                existingImages: [
                    <if condition="$res['img'] !== false">
                        <volist name="res['img']" id="v" key="k">
                            "{$v}",
                        </volist>
                    </if>
                ],
                useDataTransfer: true
            });
        });
    </script>
</body>
</html>